<?php

class index  extends hcontroller{

	public function guide(){	
		include template('home', 'guide');
	}
	public function init()
	{	
		$test = srv_test::I();
		$test->echo_a();
		$test1 = srv_test::I();
		$test1->echo_a();
		$test2 = new srv_test();
		$test2->echo_a();
		$test3 = new srv_test();
		$test3->echo_a();
// 		$test2->test();
// 		$test->halloworld();
		// 		include template('home', 'init');
	}
	private function get_login_info(){
		$user=$this->_user();
		
		return $user;
	}
	public function login(){			
		if(isset($_GET["result"])){
			$data['result']=intval($_GET["result"]);			
			$data["from"]="passport";
			switch ($data['result']){
				case 0:
					if(!$this->_islogin()){
						$data["result"]=1;
						$data["msg"]="出现未知异常";
					}
					$user=$this->_user();
					if($user["classid"]){
						$data["url"]=hurl("bj", "qinfen", "view",array("id"=>$user["classid"]));
					}else{
						$data["url"]=h_uc_index_url();
					}
					break;
				case 3:
					$data["msg"]="账号未激活，<a href=\"".hurl('passport','index','sendmail',array("send"=>1))."\" >立即激活</a>";
					break;
				case 2:
					$data["data"]=array("url"=>hurl('passport','index','forbid'));
					break;
				default:
					$data["msg"]=$_GET["msg"];
					break;
			}
		}else{
			$user=$this->get_login_info();					
			$dkid=intval($_GET["dkid"]);		
			$data["dktotal"]=srv_dk_service2::I()->get_sign_count_bylessonid($dkid);
			$data["dktotal"]=intval($data["dktotal"]);
			$zwid=intval($_GET["zwid"]);
			$zwtg=srv_blog_zw::I()->get_participate_numbers($zwid);
			$data["zwtougao"]=intval($zwtg["blogs"]);
			$data["total930"]=srv_dk_service2::I()->get_sign_count_930();
			if($user){
				$data["result"]=0;
				//弹窗消息
				core::load_module_classes('uc','xx_utl');
				$data["xxhtml"]=xx_utl::get_pop_info($user["uid"]);
				$tpldata=array("user"=>$user);
				$data['loginhtml']=$this->_widget("home", "init_login", $tpldata,true);
				
			}else{
				$data["result"]=-1;
			}
			
			global $HGRP_CFG;
			$anli=srv_grp_service::I()->get_group($HGRP_CFG['case_id']);
			$exam=srv_grp_service::I()->get_group($HGRP_CFG['exam_id']);
			$read=srv_grp_service::I()->get_group($HGRP_CFG['read_id']);
			$study=srv_grp_service::I()->get_group($HGRP_CFG['21day_id']);
			
			$data['total1']=intval($anli["member_count"]);
			$data['total2']=intval($study["member_count"]);
			$data['total3']=intval($exam["member_count"]);
			$data['total4']=intval($read["member_count"]);
		}		
		$json=json_encode($data);
		include template('home', 'loginutl');		
	}
	
}



?>